package com.cn.chaomeng.vo.table;

import com.cn.chaomeng.model.Orders;
import com.cn.chaomeng.model.User;
import com.cn.chaomeng.utils.DateUtil;

import java.util.Date;

/**
 * @author LYJ
 *         Created by Administrator on 2018/3/7 0007.
 */
public class OrdersTable {
    private Integer orderId;
    private Integer userId;
    private String userName;
    private Integer shopid;
    private String state;
    private Integer totalCount;
    private Double totalPrices;
    private String xiaofei;
    private String payment;
    private String createTime;

    public OrdersTable(Orders orders, User user){
        this.orderId = orders.getOrderid();
        if(user != null){
            this.userId = user.getId();
            this.userName = user.getUsername();
        }
        this.shopid = orders.getShopid();
        this.state = orders.getState();
        this.totalCount = orders.getTotalcount();
        this.totalPrices = orders.getTotalprices();
        this.xiaofei = orders.getXiaofei();
        this.payment = orders.getPayment();
        if(orders.getCreateTime() != null){
            this.createTime = DateUtil.getDateTimeFormat(new Date(Integer.parseInt(orders.getCreateTime())));
        }
    }

    public Integer getOrderId() {
        return orderId;
    }

    public void setOrderId(Integer orderId) {
        this.orderId = orderId;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Integer getShopid() {
        return shopid;
    }

    public void setShopid(Integer shopid) {
        this.shopid = shopid;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }

    public Double getTotalPrices() {
        return totalPrices;
    }

    public void setTotalPrices(Double totalPrices) {
        this.totalPrices = totalPrices;
    }

    public String getXiaofei() {
        return xiaofei;
    }

    public void setXiaofei(String xiaofei) {
        this.xiaofei = xiaofei;
    }

    public String getPayment() {
        return payment;
    }

    public void setPayment(String payment) {
        this.payment = payment;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
}
